#ifndef __db_auth_mgmt_h__
#define __db_auth_mgmt_h__

#include "mysql.h"
#include "db_query.h"

typedef struct __user_info
{
	char  user[32];		//user name
	char  auth[256];	//password or authentication string
	char  tm_reg[32];	//register time
	char  tm_log[32];	//last login time
	char  ip_log[16];	//last login IP address
	int   st_log;		//last login status: 0.failed, 1.success
}USER_INFO;

void AUDIT_CREATE_TAB(char* table_name, MYSQL* dbsock);
int AUDIT_ADD_USER(struct __user_info* userinfo, char* table, MYSQL* dbsock_audit);
int AUDIT_UPDATE(char* sql,	MYSQL* dbsock);
int AUDIT_QUERY_VAR(char* sql, struct __return_struct* retst, MYSQL* dbsock);

int AUDIT_DEL_USER(struct __user_info* userinfo, char* table, MYSQL* dbsock);

//int SQL_QUERY_VAR(char* sql, struct __return_struct* retst, MYSQL* dbsock);
//char* VARVAL(struct __return_struct retst, int Row, int Col);
//void QUERY_VAR_FREE(struct __return_struct* retst);

int MYSQL_ADD_USER(struct __user_info* userinfo, char* dbname, char* table,
					MYSQL* dbsock);

int MYSQL_DEL_USER(struct __user_info* userinfo, MYSQL* dbsock);

extern char DBA_PASSWORD[];

#endif
